package ga_MSA;
import java.io.*;

/**
 * 
 *  >beta globin
	MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPKVKAHGKKVLGAFS
	DGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHHFGKEFTPPVQAAYQKVVAGVANALAHKYH
	>myoglobin
	MGLSDGEWQLVLNVWGKVEADIPGHGQEVLIRLFKGHPETLEKFDKFKHLKSEDEMKASEDLKKHGATVLTAL
	GGILKKKGHHEAEIKPLAQSHATKHKIPVKYLEFISECIIQVLQSKHPGDFGADAQGAMNKALELFRKDMASNYKELGFQG
	>neuroglobin
	MERPEPELIRQSWRAVSRSPLEHGTVLFARLFALEPDLLPLFQYNCRQFSSPEDCLSSPEFLDHIRKVMLVIDA
	AVTNVEDLSSLEEYLASLGRKHRAVGVKLSSFSTVGESLLYMLEKCLGPAFTPATRAAWSQLYGAVVQAMSRGWDGE
	>soybean
	MVAFTEKQDALVSSSFEAFKANIPQYSVVFYTSILEKAPAAKDLFSFLANGVDPTNPKLTGHAEKLFALVRDSA
	GQLKASGTVVADAALGSVHAQKAVTDPQFVVVKEALLKTIKAAVGDKWSDELSRAWEVAYDELAAAIKKA
	>rice
	MALVEDNNAVAVSFSEEQEALVLKSWAILKKDSANIALRFFLKIFEVAPSASQMFSFLRNSDVPLEKNPKLKTHA
	MSVFVMTCEAAAQLRKAGKVTVRDTTLKRLGATHLKYGVGDAHFEVVKFALLDTIKEEVPADMWSPAMKSAWSEAYDHLVAAIKQEMKPAE
 *
 */

public class MSA {
	
	private String[] seq;
	private int[] size;
	public int maxW = 5;
	public int maxL;
	
	public MSA () {
		seq = new String[maxW];
		//seq[0] = "CCCATTAT";
		//seq[1] = "ATAT";
		//seq[2] = "CCTGA";
		seq[0] = "MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFG" +
				 "DLSTPDAVMGNPKVKAHGKKVLGAFSDGLAHLDNLKGTFATLSELHCDKLHVDPE" +
				 "NFRLLGNVLVCVLAHHFGKEFTPPVQAAYQKVVAGVANALAHKYH";
		seq[1] = "MGLSDGEWQLVLNVWGKVEADIPGHGQEVLIRLFKGHPETLEKFDKFK" +
				 "HLKSEDEMKASEDLKKHGATVLTALGGILKKKGHHEAEIKPLAQSHATKHKIPVK" +
				 "YLEFISECIIQVLQSKHPGDFGADAQGAMNKALELFRKDMASNYKELGFQG";
		seq[2] = "MERPEPELIRQSWRAVSRSPLEHGTVLFARLFALEPDLLPLFQYNCR" +
				 "QFSSPEDCLSSPEFLDHIRKVMLVIDAAVTNVEDLSSLEEYLASLGRKHRAVGVKLS" +
				 "SFSTVGESLLYMLEKCLGPAFTPATRAAWSQLYGAVVQAMSRGWDGE";
		seq[3] = "MVAFTEKQDALVSSSFEAFKANIPQYSVVFYTSILEKAPAAKDLFSFLA" +
				 "NGVDPTNPKLTGHAEKLFALVRDSAGQLKASGTVVADAALGSVHAQKAVTDP" +
				 "QFVVVKEALLKTIKAAVGDKWSDELSRAWEVAYDELAAAIKKA";
		seq[4] = "MALVEDNNAVAVSFSEEQEALVLKSWAILKKDSANIALRFFLKIFEVAPSASQMFSFLR" +
				 "NSDVPLEKNPKLKTHAMSVFVMTCEAAAQLRKAGKVTVRDTTLKRLGATHLKYGVGDA" +
				 "HFEVVKFALLDTIKEEVPADMWSPAMKSAWSEAYDHLVAAIKQEMKPAE";
		/*seq[0] = "MQEQATSSLAASSLPSSSERSSSSAPHLEIKEGIESDEEIRRVPEFGGEAVGKETSGRESGSATGQERTQATVG" +
				"ESQRKRGRTPAEKENKRLKRLLRNRVSAQQARERKKAYLSELENRVKDLENKNSE" +
				"LEERLSTLQNENQMLRHILKNTTGNKRGGGGGSNADASL";
		seq[1] = "MQEQATSSIAASSLPSSSERSSSSALHHELKEGMESDDEIRRVPEMGGEATGTTSA" +
				"SGRDGVSAAGQAQPSAGTQRKRGRSPADKENKRLKRLLRNRVSAQQARERKKAYLIDLEARVK" +
				"ELETKNAELEERLSTLQNENQMLRHILKNTTAGAQEGRK";
		seq[2] = "MAAQEQEQEKQQVKTSTTSSLPSSSERSSSSAPNNLKEGGGVESDEEIRRVPEMGGGGGSASSGAG" +
				"ADERQGKEDGKQQGGGGGGAAAAGGGQEQAPPARKRGRSAGDKEQNRLKRLLRNRVSAQQARERKKAYMTELE" +
				"AKAKDLELRNAELEQRVSTLQNENNTLRQILKNTTAHAGKRGGGGGGKGGDGGGGGKKHHFTKS";
		seq[3] = "MTIKRKDDGQVVKQSVKAVGGGLLERVDSDDEEIVGRVPEFGLALPGTSTSGRGSVRVAGDAAATAAG" +
				"TSSSSPAAQAGVAGSSSSGRRRGRSPADKEHRRLKRLLRNRVSAQQARERKKAYMSELEARVKDLERSNSELEE" +
				"RLSTLQNENQMLRQVLKNTTANRRGPDSSAGGDS";
		seq[4] = "MQEQATSSRPSSSERSSSSGGHHMEIKEGKEAPLRSLLLPFLDFHFTVPLSGMESDEEIGRVPELGLEPGGASTSG" +
				"RAAGGGGGGAERAQSSTAQASARRRGRSPADKEHKRLKRLLRNRVSAQQARERKKAYLNDLEVKVKDLEKKNSELEERFSTL" +
				"QNENQMLRQILKNTTVSRRGPGSTASGEGQ";*/
		/*seq[0] = "SSLPSSSERSSSSAPHLEIKEGIESDEEIRRVPEFGGEAVGKETSGRESGSATGQERTQATVG" +
			"ESQRKRGRTPAEKENKRLKRLLRNRVSAQQARERKKAYLSELENRVKDLENKNSE" +
			"LEERLSTLQNENQMLRHILKNTTGNKRGGGGGSNADASL";
		seq[1] = "SSLPSSSERSSSSALHHELKEGMESDDEIRRVPEMGGEATGTTSA" +
				"SGRDGVSAAGQAQPSAGTQRKRGRSPADKENKRLKRLLRNRVSAQQARERKKAYLIDLEARVK" +
				"ELETKNAELEERLSTLQNENQMLRHILKNTTAGAQEGRK";
		seq[2] = "SSLPSSSERSSSSAPNNLKEGGGVESDEEIRRVPEMGGGGGSASSGAG" +
				"ADERQGKEDGKQQGGGGGGAAAAGGGQEQAPPARKRGRSAGDKEQNRLKRLLRNRVSAQQARERKKAYMTELE" +
				"AKAKDLELRNAELEQRVSTLQNENNTLRQILKNTTAHAGKRGGGGGGKGGDGGGGGKKHHFTKS";*/
		/*try {
			  FileInputStream fstream = new FileInputStream("F:/workspace/MPGA_new/src/ga_MSA/BOX012.txt");
		
			  // Get the object of DataInputStream
			  //DataInputStream in = new DataInputStream(fstream);
			  BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
			  String strLine;
			  //Read File Line By Line
			  int line = 0;
			  strLine = br.readLine();
			  while (strLine != null)   {
			  // Print the content on the console
				   System.out.println (strLine);
				   if (strLine.charAt(0) == '>') {
					   strLine = br.readLine();
					   while ( strLine != null && strLine.charAt(0) != '>' ) {
						   if (strLine.length() > 0)
							   seq[line] += strLine.replaceAll("u", "");
						   System.out.println (strLine);
						   strLine = br.readLine();
					   }
					   line++;
				   }
			  }
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		
		size = new int[maxW];
		for (int i = 0; i < maxW; i++) {
			size[i] = seq[i].length();
			if (size[i] > maxL)
				maxL = size[i];
		}
		//adding 30 gaps
		maxL += 10;
	}
	
	public int length(int index) {
		return size[index];
	}
	
	public char getChar(int W, int L) {
		return seq[W].charAt(L);
	}

}
